package io.renren.modules.edu.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.modules.edu.dao.EduStudentDao;
import io.renren.modules.edu.dto.EduStudentDTO;
import io.renren.modules.edu.entity.EduStudentEntity;
import io.renren.modules.edu.service.EduStudentService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * 
 *
 * @author Mark sunlightcs@gmail.com
 * @since 1.0.0 2023-04-17
 */
@Service
public class EduStudentServiceImpl extends CrudServiceImpl<EduStudentDao, EduStudentEntity, EduStudentDTO> implements EduStudentService {

    ////根据id查询
//    @Override
//    public QueryWrapper<EduStudentEntity> getWrapper(Map<String, Object> params){
//        String id = (String)params.get("id");
//
//        QueryWrapper<EduStudentEntity> wrapper = new QueryWrapper<>();
//        wrapper.eq(StringUtils.isNotBlank(id), "id", id);
//
//        return wrapper;
//    }

    //根据名字查询
    @Override
    public QueryWrapper<EduStudentEntity> getWrapper(Map<String, Object> params){
        String name = (String)params.get("name");

        QueryWrapper<EduStudentEntity> wrapper = new QueryWrapper<>();
//        wrapper.eq(StringUtils.isNotBlank(name), "name", name);

        //模糊查询
        wrapper.like(StringUtils.isNotBlank(name), "name", name);

        return wrapper;
    }


}